﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace InfonavaEye.components
{
    public partial class UniPageTitle : UserControl
    {
        private string pageTitle ="页面标题";

        private bool showBack = true;
       
        /// <summary>
        /// 显示返回按钮:true显示，false不显示
        /// </summary>
        [Browsable(true), Category("外观"), Description("显示返回按钮:true显示，false不显示")]
        public bool ShowBack
        {
            get { return showBack; }
            set { showBack = value; }
        }

        /// <summary>
        /// 页面标题文字
        /// </summary>
        [Browsable(true), Category("外观"), Description("页面标题文字")]
        public string PageTitle
        {
            get { return pageTitle; }
            set { 
                pageTitle = value;
                this.lblTitle.Text = this.PageTitle;
            }
        }

        public UniPageTitle()
        {
            InitializeComponent();
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.ParentForm.Close();
        }

        private void UniPageTitle_Load(object sender, EventArgs e)
        {
            this.lblTitle.Text = this.PageTitle;
            if (!showBack)
            {
                this.picBack.Visible = false;
                this.lblTitle.Location = new Point(0, this.lblTitle.Location.Y);
            }
        }
    }
}
